import zh_CN from './zh_cn';
import en_US from './en_us';

function getLang() {
  return window.UILessConfig?.lang || 'zh_CN';
}

function get(key, defaultValue) {
  const local = {
    zh_CN,
    en_US,
  };
  return (local[getLang()] || zh_CN)[key] || defaultValue;
}

function auto(zh_CN1, en_US1) {
  return getLang() === 'zh_CN' ? zh_CN1 : en_US1;
}

export default {
  getLang,
  get,
  auto,
};
